<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html rsf:id="html" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"/>
<script rsf:id="scr=portal-matter" src="/library/js/headscripts.js"></script>
<script src="/library/js/spinner.js" type="text/javascript"></script>
<link rsf:id="scr=portal-matter" href="/library/skin/tool_base.css" type="text/css" rel="stylesheet" media="all" />
<link rsf:id="scr=portal-matter" href="/library/skin/default-skin/tool.css" type="text/css" rel="stylesheet" media="all" />

<title rsf:id="msg=simplepage.edit-page"></title>
</head>
<body rsf:id="scr=sakai-body">
<script>includeLatestJQuery('EditPage.html');</script>

	<div class="portletBody">
	
	<p rsf:id="debugstuff"> junk </p>
    <h3><span rsf:id="title-label"></span><span class="bold" style="margin-left:5px;" rsf:id="page-title"></span></h3>
		<form rsf:id="page_form">
		<input type="hidden" rsf:id="csrf"/>

			<div rsf:id="instructions">Enter your page content below</div>
			
			<div class="longtext">
	            
				<textarea rsf:id="page:">
				</textarea>
            </div>
	 <div class="my-3" rsf:id="prerequisite-block">
            <input type="checkbox" id="question-prerequisite" rsf:id="question-prerequisite"/><label rsf:id="msg=simplepage.prerequisites_label" for="question-prerequisite"></label>
	 </div>
	<sakai-condition-picker rsf:id="edit-condition-picker" id="edit-condition-picker" class="hidden"></sakai-condition-picker>
			
<span style="display:none;" id="deleteButtonLangSupp" rsf:id="msg=simplepage.delete_page_confirm"></span>
<script>

$(function() {
    $("#grouplist").hide();
    if ($('#grouplist input').size() == 0) {
	$('#editgroups').hide();
    }
    $("#editgroups").click(function() {
         $("#grouplist").show();
         $("#editgroups").hide();
       });
});

jQuery(document).ready(function($) {
	var confirmMsg = document.getElementById('deleteButtonLangSupp').innerHTML;
    $('.deleteButton').click(function() {
        return confirm(confirmMsg);
    });

    const itemId = document.querySelector("input[name='itemId']")?.value;

    // RSF doesn't like the javascript and operator
    if (itemId) if (itemId != -1) {
        const editConditionPicker = document.getElementById("edit-condition-picker");
        editConditionPicker.setAttribute("item-id", itemId);
        editConditionPicker.classList.remove("hidden");
    }
});

</script>


			<p id="editgroups" class="edit-group my-3">
			  <a href="#"><span rsf:id="msg=simplepage.edit-group"></span></a>
			</p>

			<div id="grouplist" rsf:id="grouplist">
			  <span rsf:id="group-list-span"/>
			  <p class="sak-banner-info" rsf:id="msg=simplepage.select-group"></p>
			  <div rsf:id="select-group-list:">
			    <input class="me-2" type="checkbox" rsf:id="select-group" /><input type="checkbox" rsf:id="select-group-checked" checked="checked" /><span rsf:id="select-group-text"></span>
			  </div>
			</div>

			<p class="act">
				<input type="hidden" rsf:id="addBefore" />
				<input accesskey ="s" rsf:id="save" value="Save" type="submit" class="active" onclick="SPNR.disableControlsAndSpin( this, null );"/>
				<input accesskey ="x" rsf:id="cancel" value="Cancel" type="submit"/>
                <input type="submit" rsf:id="delete" class="deleteButton" />
			</p>						
		</form>
	</div>
</body>
</html>
